﻿using AutoMapper;
using Esosi.Register.Base.Dtos;
using Esosi.Register.Hospital.Models;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace Esosi.Register.Hospital.Profiles
{
    public class HospitalTpoProfile : Profile
    {
        public HospitalTpoProfile()
        {
            CreateMap<RegisterHospitalTpo, RegisterCalcTpoDto>()
                .ForMember(dest => dest.MustPay, opt => opt.MapFrom(src => src.YingShou))
                .ForMember(dest => dest.TotalFees, opt => opt.MapFrom(src => src.TotalFee))
                .ForMember(dest => dest.JsonGuid, opt => opt.MapFrom(src => src.JsonGuid))
                .ForMember(dest => dest.BalanceCalcMessageShow, opt => opt.MapFrom(src =>
                $"个人支付：￥{src.PaySums.Where(p => p.InvoicePayMode == Entity.InvoicePayMode.PersonPayCode).Sum(p => p.FeeSum)} 元  "))
                ;
        }
    }
}